package com.qk.mapper;

import com.qk.entity.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RoleMapper {

    List<Role> listRoles(@Param("name") String name, @Param("label") String label);

    @Delete("delete from role where id=#{id}")
    void deleteById(Integer id);

    @Insert("insert into role(name,label,remark,create_time,update_time) values(#{name},#{label},#{remark},#{createTime},#{updateTime})")
    void addRole(Role role);

    @Select("select id,name,label,remark,create_time,update_time from role where id=#{id}")
    Role getRoleById(Integer id);

    @Update("update role set name=#{name},label=#{label},remark=#{remark},update_time=#{updateTime} where id=#{id}")
    void updateRole(Role role);

    @Select("select id,name,label,remark,create_time,update_time from role")
    List<Role> listAllRoles();
}
